home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Clock / Sources / Part.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  4.1 KB  |  134 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Part.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef PART_H
  11. #define PART_H
  12.  
  13. // ----- Framework Layer -----
  14.  
  15. #ifndef FWPART_H
  16. #include "FWPart.h"
  17. #endif
  18.  
  19. // ----- OS Layer -----
  20.  
  21. #ifndef FWMNUITM_H
  22. #include "FWMnuItm.h"
  23. #endif
  24.  
  25. #ifndef FWTIME_H
  26. #include "FWTime.h"
  27. #endif
  28.  
  29. //========================================================================================
  30. // Classes used by this interface
  31. //========================================================================================
  32.  
  33. class CClockContent;
  34.  
  35. //========================================================================================
  36. // Constants
  37. //========================================================================================
  38.  
  39. const short kAnalogClock = 1;
  40. const short kDigitalClock = 2;
  41.  
  42. //========================================================================================
  43. // CClockPart
  44. //========================================================================================
  45.  
  46. class CClockPart : public FW_CPart
  47. {
  48. public:
  49.     FW_DECLARE_AUTO(CClockPart)
  50.  
  51. //----------------------------------------------------------------------------------------
  52. //    Initialization/Destruction
  53. //
  54. public:
  55.     CClockPart(ODPart* odPart);
  56.     virtual void Initialize(Environment* ev, ODStorageUnit* storageUnit, FW_Boolean fromStorage);
  57.  
  58.     virtual ~ CClockPart();
  59.  
  60. //----------------------------------------------------------------------------------------
  61. //    Inherited API
  62. //
  63. public:
  64.     // ----- Factory Methods -----    
  65.     virtual FW_CFrame*         NewFrame(Environment* ev, ODFrame* odFrame, FW_CPresentation* presentation, FW_Boolean fromStorage);
  66.     virtual FW_CContent*     NewPartContent(Environment* ev);
  67.     
  68.     virtual FW_Handled        DoIdle(Environment* ev, const FW_CNullEvent& theNullEvent);
  69.     
  70.     virtual FW_Handled         DoMenu(Environment* ev, const FW_CMenuEvent& theMenuEvent);
  71.     virtual FW_Handled         DoAdjustMenus(Environment* ev, FW_CMenuBar* menuBar, FW_Boolean hasMenuFocus, FW_Boolean isRoot);
  72.     virtual FW_Handled         DoAbout(Environment* ev);
  73.     
  74. //----------------------------------------------------------------------------------------
  75. //    New API
  76. //
  77. public:    
  78.     void                     PlayTickSound();
  79.     void                     PlayChimeSound();
  80.     
  81.     FW_CPresentation*        SwitchPresentation(FW_CPresentation* currentPresentation) const;
  82.     FW_Boolean                IsAnalog(FW_CPresentation* presentation) const;
  83.  
  84.     short                    Tick(Environment* ev, FW_CPresentation* presentation, const FW_CTime& currentTime);
  85.     void                    SynchContainingPartProperties(Environment* ev, FW_CPresentation* presentation);
  86.     
  87.     FW_Boolean                UseContainerColor() const;
  88.     
  89.     void                    SetClock(Environment* ev, long hourOffset, const FW_CString& faceString);
  90.  
  91. private:
  92.     void                    OpenClockSettingsDialog(Environment* ev);
  93.  
  94. //----------------------------------------------------------------------------------------
  95. //    Data Members
  96. //
  97. private:
  98.     FW_CTime             fLastTime;
  99.     CClockContent*        fClockContent;    
  100.     FW_Boolean            fLockIdle;            // Use to block idle while changing clock type    
  101.     FW_CIdler*            fIdler;
  102.     
  103.     FW_CPresentation*    fAnalogPresentation;    
  104.     FW_CPresentation*    fDigitalPresentation;    
  105.     FW_CPresentation*    fClockSettingsPresentation;    
  106.  
  107. #ifdef FW_BUILD_MAC
  108.     FW_PlatformHandle     fChimeSound;
  109.     FW_PlatformHandle     fTickSound;
  110. #endif
  111.  
  112.     FW_Boolean            fUseContainerColor;
  113. };
  114.  
  115. //----------------------------------------------------------------------------------------
  116. // CClockPart::UseContainerColor
  117. //----------------------------------------------------------------------------------------
  118.  
  119. inline FW_Boolean CClockPart::UseContainerColor() const
  120. {
  121.     return fUseContainerColor;
  122. }
  123.  
  124. //----------------------------------------------------------------------------------------
  125. // CClockPart::IsAnalog
  126. //----------------------------------------------------------------------------------------
  127.  
  128. inline FW_Boolean CClockPart::IsAnalog(FW_CPresentation* presentation) const
  129. {
  130.     return presentation == fAnalogPresentation;
  131. }
  132.  
  133. #endif
  134.